package com.hugehard.here;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * Main activity to show Google Map and manage SMS issues.
 * 
 * @author wingyip, andrewpiggy
 */
public class MainActivity extends BaseActivity {

	// U.S. phone number.
	public static String PHONE_NUMBER = "+19172924185";
	// (TODO) Wingyip, please try whether it works in China.
	// China phone number.
	// private static String PHONE_NUMBER = "";

	private static String SMS_TEXT = "37.424,-122.084";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_activity);

		getActionBar().setDisplayShowTitleEnabled(false);

		View btnShowMap = findViewById(R.id.show_map_btn);
		btnShowMap.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(MainActivity.this,
						ShowMapActivity.class);
				startActivity(intent);
			}
		});

		// Button btnSendMessage = (Button) findViewById(R.id.send_message_btn);
		// btnSendMessage.setOnClickListener(new OnClickListener() {
		// @Override
		// public void onClick(View v) {
		// // Hard code the phone number and text in demo.
		// try {
		// SmsManager smsManager = SmsManager.getDefault();
		// smsManager.sendTextMessage(PHONE_NUMBER, null, SMS_TEXT, null, null);
		// Toast.makeText(getApplicationContext(), "SMS Sent!",
		// Toast.LENGTH_LONG).show();
		// } catch (Exception e) {
		// Toast.makeText(getApplicationContext(),
		// "SMS faild, please try again later!",
		// Toast.LENGTH_LONG).show();
		// e.printStackTrace();
		// }
		// }
		// });

		View btnShowContact = findViewById(R.id.show_contacts_btn);
		btnShowContact.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(MainActivity.this,
						ContactsActivity.class);
				startActivity(intent);
			}
		});
	}
}
